<div id="shprices">
	<?php //echo $this->form ?>
	<form method="<?php echo $this->form->getMethod();?>" action="<?php echo $this->form->getAction();?>" enctype="<?php echo $this->form->getEncType();?>" id="<?php echo $this->form->getName();?>">
		<dl class="zend_form">
			<?php echo $this->form->getElement('author');?>
			<?php echo $this->form->getElement('cost');?>
			<?php echo $this->form->getElement('currencyid');?>
			<?php echo $this->form->getElement('actualto');?>
			<?php echo $this->form->getElement('descr');?>
			<dt>&nbsp;</dt>
			<dd><div id="captcha_div"></div></dd>
			<?php echo $this->form->getElement('submit');?>
		</dl></form>
	<?php foreach ($this->offers as $offer):?>
		<div class="bb" style="margin:5px 0;font-size:0.9em;">
			<table>
				<tr>
					<td><em class="bigger strong high"><?php echo $offer->PRICE_AUTHOR?></em>&nbsp;|&nbsp;<em class="nonhigh">Актуально до: <?php echo date('j.m.Y', strtotime($offer->PRICE_ACTUALTO));?></em></td>
				</tr>
				<tr>
					<td>
						<?php
							switch ($offer->PRICE_CURRENCYID) {
								case '1':
									$currencyShorter = ' грн.';
								break;
								case '2':
									$currencyShorter = ' руб.';
								break;
								case '3':
									$currencyShorter = '$';
								break;
								default: $currencyShorter = ' euro';
							}
						?>
						<em>Цена</em>: <em class="bigger strong"><?php echo $offer->PRICE_COST . $currencyShorter;?></em>
					</td>
				</tr>
				<tr>
					<td>
						<em>Описание</em>: <?php echo mb_substr($offer->PRICE_DESCR, 0, 500, 'utf-8');?>
					</td>
				</tr>
			</table>
		</div>
	<?php endforeach;?>
</div>

<script type="text/javascript">
	$("input:submit, input:button, button").button();
	$("#actualto").datepicker($.datepicker.regional['ru']);
	$("#actualto").datepicker('option', {dateFormat:'yy-mm-dd'});
	$("#<?php echo $this->form->getName();?>").submit(function(event) {
		event.preventDefault();
		var cont = $("#shprices").parent();
		$.post(
			$(this).attr("action"),
			$(this).serialize(),
			function(data) {
				$.get(
					'/catalog/products/shprices/product/<?php echo $this->product->getAlias();?>/format/html',
					function(data) {
						$("#shprices").slideUp('slow', function() {
							$("#shprices").detach();
						});
						cont.html(data);
						$("#shprices").slideDown('slow');
					}
				);
			}
		);
/*		$.post(
			"http://www.google.com/recaptcha/api/verify",
			{ privatekey: "<?php echo Zend_Registry::get('config')->recaptcha->privatekey;?>", remoteip: getUserIP(), challenge: $("#recaptcha_challenge_field").val(), response: $("#recaptcha_response_field").val()},
			function(data) {
				alert("Data Loaded: " + data);
			}
		);*/
		cont.html('Добавление цены...');
		return false;
	});

	Recaptcha.create(
		"<?php echo Zend_Registry::get('config')->recaptcha->publickey;?>",
		"captcha_div",
		{
		  theme: "red",
		  lang: "ru",
		  callback: Recaptcha.focus_response_field
		}
	);
</script>
